package main

import (
	"fmt"
	"strings"
	"golang.org/x/tour/wc"
)
func WordCount(s string) map[string]int {
	//strings.Field返回的是切片
	slice:=strings.Fields(s)
	length:=len(slice)
	var m map[string]int
	m=make(map[string]int)
	for i:=0;i<length;i++{
	  m[slice[i]]+=1
	}
	
	return m
}


func main() {
	wc.Test(WordCount)
	a:="i am genius"
	fmt.Println(strings.Fields(a))
}
